package cn.sciento.farm.devicemanager.common.constant;

/**
 * @author wumu
 * @version V1.0
 * @date 4/20/18
 * @time 4:21 PM
 */
public enum CollectionTypeEnum {
    /** 空气湿度 */
    AIRH("airH", "空气湿度", "％", 10),
    /** 空气温度 */
    AIRT("airT", "空气温度", "℃",10),
    /** 光照度 */
    ILL("ill", "光照度", "Lux",1),
    /** 土壤湿度 */
    SOILH("soilH", "土壤湿度", "％",10),
    /** 土壤温度 */
    SOILT("soilT", "土壤温度", "℃",10),
    /** 土壤EC */
    SOILC("soilC", "土壤EC", "us/cm",1),
    /** 土壤盐分 */
    SOILS("soilS","土壤盐分","ppm",1),
    /** CO2浓度 */
    CO2("co2", "CO2浓度", "ppm",1),
    /** PH值 */
    DPH("dPH", "PH值", "",10),
    /** 风速 */
    WINDS("windS", "风速", "m/s",10),
    /** 风向 */
    WINDD("windD", "风向", "度",10),
    /** 气压 */
    ATM("atm", "气压", "hPa",10),
    /** 降雨量 */
    RAINF("rainF", "降雨量", "mm",10),
    /** 日照时数 */
    SDUR("sDur", "日照时数", "分钟",10),
    /** 日照时长 */
    SADUR("sADur", "日照时长", "h",1),
    /** 蒸发量 */
    ECAP("eCap", "蒸发量", "mm",100),
    /** TBQ */
    TBQ("TBQ", "TBQ", "w/m2",10),
    /** 光合辐射 */
    PAR("PAR", "光合辐射", "W",1),
    /** PM2.5 */
    PM25("pm25", "PM2.5", "ug/m3",1),
    /** PM10 */
    PM10("pm10", "PM10", "ug/m3",1),
    /** 雨雪 */
    SLEET("sleet","雨雪","",1),
    /** 湿式PH值 */
    WPH("wPH", "湿式PH值", "",100),
    /** 二氧化硫 */
    SO2("SO2","二氧化硫","ppm",100),
    /** 噪声 */
    NOISE("Noise","噪声","dB",10),
    /** 氨氮 */
    NH3N("NH3N","氨氮","mg/L",10),
    /** 水温 */
    LIQUIDT("LiquidT","水温","%C",10),
    /** 氨气 */
    NH3("NH3","氨气","ppm",1),
    /** 溶解氧 */
    DO("DO","溶解氧","mg/L",100),
    /** 氧化还原电位 */
    ORP("ORP","氧化还原电位","mV",10),
    /** 浊度 */
    TURBIDITY("turbidity","浊度","NTU",10),
    /** 硫化氢 */
    H2S("H2S","硫化氢","ppm",10),
    /** 氧气 */
    O2("O2","氧气","%",10),
    /** 液体瞬时流量 */
    INSTANTFLOW("instantFlow","液体瞬时流量","L/h",10),
    /** 液体累计流量 */
    TOTALFLOW("totalFlow","液体累计流量","L",10),
    /** 烟雾报警器 */
    SMOKEALARM("smokeAlarm","烟雾报警器","",1),
    /** 水浸传感器 */
    WATER("water","水浸传感器","",1),
    /** 土壤氮 */
    SN("sN","土壤氮","mg/L",1),
    /** 土壤磷 */
    SP("sP","土壤磷","mg/L",1),
    /** 土壤钾 */
    SK("sK","土壤钾","mg/L",1),
    /** 沟渠水位 */
    DITCHLEVEL("ditchLevel","沟渠水位","m",1000),
    /** 沟渠瞬间流量 */
    DITCHINSTANT("ditchInstant","沟渠瞬间流量","L/s",10000),
    /** 沟渠累积流量 */
    DITCHTOTAL("ditchTotal","沟渠累积流量","m3",100),
    /** 甲醛 */
    CH2O("CH2O","甲醛","ppb",1),
    /** 总悬浮颗粒物 */
    TSP("TSP","总悬浮颗粒物","ug/m3",1),
    /** 总有机气态物质 */
    TVOC("TVOC","总有机气态物质","ppb",1),
    /** 一氧化碳浓度 */
    CO("CO","一氧化碳浓度","ppm",10),
    /** 负氧离子浓度 */
    O2_("O2-","负氧离子浓度","个/cm3",1),
    /** 电池电压 */
    VBAT("vbat","电池电压","V",1000),

    NULL("","","",1);

    private String type;
    private String name;
    private String unit;
    private Integer proportion;

    private CollectionTypeEnum(String type, String name, String unit, Integer proportion) {
        this.name = name;
        this.type = type;
        this.unit = unit;
        this.proportion = proportion;
    }

    public static String getName(String type) {
        for (CollectionTypeEnum collectionTypeEnum : CollectionTypeEnum.values()) {
            if (collectionTypeEnum.getType().equals(type)) {
                return collectionTypeEnum.getName();
            }

        }
        return type;
    }

    public static CollectionTypeEnum get(String type) {
        for (CollectionTypeEnum collectionTypeEnum : CollectionTypeEnum.values()) {
            if (collectionTypeEnum.getType().equals(type)) {
                return collectionTypeEnum;
            }

        }
        return  CollectionTypeEnum.NULL;
    }

    public String getType() {
        return type;
    }

    public String getName() {
        return name;
    }

    public String getUnit() {
        return unit;
    }

    public Integer getProportion() {
        return proportion;
    }
}
